package com.mcx.modules.data.localdata.create;

import com.mcx.modules.data.GameDataTableParser;
import com.mcx.modules.data.base.AbstractDBModel;

/** Role数据管理 */
public class RoleDBModel extends AbstractDBModel<RoleDBModel, RoleEntity>
{
    private static RoleDBModel instance;

    public static RoleDBModel getInstance() {
        if (instance == null) {
            instance = new RoleDBModel();
        }
        return instance;
    }

    /** 文件名称 */
    @Override
    protected String FileName() {
        return "Role.data";
    }

    /** 创建实体 */
    @Override
    protected RoleEntity MakeEntity(GameDataTableParser parse)
    {
        RoleEntity entity = new RoleEntity();
        entity.Id = parse.GetFieldValueToInt("Id");
        entity.Name = parse.GetFieldValueToUTF8String("Name");
        entity.HeadPic = parse.GetFieldValueToUTF8String("HeadPic");
        entity.RolePic = parse.GetFieldValueToUTF8String("RolePic");
        entity.PrefabName = parse.GetFieldValueToUTF8String("PrefabName");
        entity.Desc = parse.GetFieldValueToUTF8String("Desc");
        entity.Attack = parse.GetFieldValueToInt("Attack");
        entity.Defense = parse.GetFieldValueToInt("Defense");
        entity.Dodge = parse.GetFieldValueToInt("Dodge");
        entity.Cri = parse.GetFieldValueToInt("Cri");
        entity.VioInjury = parse.GetFieldValueToInt("VioInjury");
        entity.Res = parse.GetFieldValueToInt("Res");
        entity.UsedPhyAttackIds = parse.GetFieldValueToUTF8String("UsedPhyAttackIds");
        entity.UsedSkillIds = parse.GetFieldValueToUTF8String("UsedSkillIds");
        return entity;
    }
}
